package com.cbts.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Traffic entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "traffic", catalog = "cbts", uniqueConstraints = @UniqueConstraint(columnNames = {
		"traffic", "standard" }))
public class Traffic implements java.io.Serializable {

	// Fields

	private Integer trafficId;
	private String traffic;
	private String standard;
	private Double price;
	private Set<TravelStandard> travelStandards = new HashSet<TravelStandard>(0);

	// Constructors

	/** default constructor */
	public Traffic() {
	}

	/** minimal constructor */
	public Traffic(Integer trafficId, String traffic, String standard,
			Double price) {
		this.trafficId = trafficId;
		this.traffic = traffic;
		this.standard = standard;
		this.price = price;
	}

	/** full constructor */
	public Traffic(Integer trafficId, String traffic, String standard,
			Double price, Set<TravelStandard> travelStandards) {
		this.trafficId = trafficId;
		this.traffic = traffic;
		this.standard = standard;
		this.price = price;
		this.travelStandards = travelStandards;
	}

	// Property accessors
	@Id
	@Column(name = "trafficId", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Integer getTrafficId() {
		return this.trafficId;
	}

	public void setTrafficId(Integer trafficId) {
		this.trafficId = trafficId;
	}

	@Column(name = "traffic", nullable = false, length = 25)
	public String getTraffic() {
		return this.traffic;
	}

	public void setTraffic(String traffic) {
		this.traffic = traffic;
	}

	@Column(name = "standard", nullable = false, length = 25)
	public String getStandard() {
		return this.standard;
	}

	public void setStandard(String standard) {
		this.standard = standard;
	}

	@Column(name = "price", nullable = false, precision = 11)
	public Double getPrice() {
		return this.price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "traffic")
	public Set<TravelStandard> getTravelStandards() {
		return this.travelStandards;
	}

	public void setTravelStandards(Set<TravelStandard> travelStandards) {
		this.travelStandards = travelStandards;
	}

}